﻿/* mvcForum
 * Copyright (C) 2010-2011 Steen F. Tøttrup
 * http://mvcforum.org/
 */

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace mvcForum.Core {

	/// <summary>
	/// This class represent a category.
	/// </summary>
	public class Category {
		public Category() { }
		public Category(Board board, String name, Int32 sortOrder) {
			this.Board = board;
			this.Name = name;
			this.SortOrder = sortOrder;
		}

		#region Properties
		public Int32 Id { get; set; }
		[Required]
		public Int32 BoardId { get; set; }
		/// <summary>
		/// The board this category belongs to.
		/// </summary>
		public virtual Board Board { get; set; }
		/// <summary>
		/// The name of the category.
		/// </summary>
		[StringLength(Constants.FieldLengths.CategoryName)]
		[Required]
		public String Name { get; set; }
		/// <summary>
		/// The sort order of the category, used when visualising the bulletin board.
		/// </summary>
		[Required]
		public Int32 SortOrder { get; set; }
		#endregion

		public virtual ICollection<Forum> Forums { get; set; }
	}
}